package WordHandling;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

/**A Line object is created/drawn between every cluster and each of its associated keywords*/
public class Line {

	/**Query keyword from which this line should be drawn*/
	private Text key;
	/**X coordinate at which the line should start*/
	private int x_start;
	/**Y coordinate at which the line should start*/
	private int y_start;
	/**X coordinate at which the line should end*/
	private int x_coord_end;
	/**Y coordinate at which the line should end*/
	private int y_coord_end;
	/**Color of this line*/
	private Color color;
	/**Graphics object that will draw the line*/
	private Graphics2D graph_obj;

	
	public Line(Graphics g, int x_end, int y_end, Text word, Color c){
	    key=word;
		x_coord_end=x_end;
	    y_coord_end = y_end;
	    color=c;
	    graph_obj = (Graphics2D)g;
	    //makes color of the line same as the word form which it is drawn
		graph_obj.setPaint(color);	
	    
		g.drawLine(word.getX(), word.getY(), x_end, y_end);
	}
	
	/*public void redrawLine(Color c){
		graph_obj.setPaint(c);
		graph_obj.drawLine(key.getX(), key.getY(), x_coord_end, y_coord_end);}*/
	/**@return the color of this line*/
	public Color getColor(){
	 return color;
	}
	/**@return the X coordinate where this line ends*/
	public int getEndX(){return x_coord_end;}
	/**@return the Y coordinate where this line ends*/
	public int getEndY(){return y_coord_end;}
}
